import {
  OrderResource,
  OrderPayWechatResource,
  OPenidResource,
  checkoutOfFastOrderResource,
  getOrderListResource,
  orderResource,
  storesResource
}
from './resources'

export default {
  ordering: function(data) {
    return OrderResource.save(JSON.stringify(data));
  },
  orderPayWechat: function(data) {
    return OrderPayWechatResource.save(JSON.stringify(data));
  },
  getOpenid: function(data) {
    return OPenidResource.save(JSON.stringify(data));
  },
  checkoutOfFastOrder: function(data) {
    return checkoutOfFastOrderResource.save(JSON.stringify(data));
  },
  getOrderList: function(data) {
    return getOrderListResource.save(JSON.stringify(data))
  },
  getOrder: function(data) {
    return orderResource.get({
      id: data.id,
      controller: 'fbs'
    });
  },
  refundOrder: function(data) {
    return orderResource.save({
      id: data.id,
      controller: 'refund'
    }, JSON.stringify(data));
  },
  getWxInitByStoreId: function(id) {
    return storesResource.get({
      id: id,
      controller: 'wxinit'
    });
  },
  getOrderByWechat: function(id) {
    return orderResource.get({
      id: id,
      controller: 'wechat'
    });
  },
}
